package com.ms.education.acl.service.impl;

import com.ms.education.acl.mapper.PermissionMapper;
import com.ms.education.acl.mapper.RoleMapper;
import com.ms.education.acl.service.SaTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>Project:education-SaTokenServiceImpl
 * <p>Powered by ms on 2023-03-12 14:49:25
 *
 * @author ms
 * @version 1.0
 * @since 1.8
 */
@Service
public class SaTokenServiceImpl implements SaTokenService {

    @Autowired
    private RoleMapper roleMapper;

    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public List<String> getUserRoles(Integer userId) {
        return roleMapper.selectRolesByUserId(userId);
    }

    @Override
    public List<String> getUserPermissions(Integer userId) {
        return permissionMapper.permissionValueList(userId);
    }

    @Override
    public List<String> getPermissionByRoleName(String roleName) {
        return permissionMapper.getPermissionByRoleName(roleName);
    }
}
